package 结构型模式.组合模式;

public abstract class MenuComponent {
    //菜单组件的名称
    protected String name;
    //菜单组件的层级
    protected int level;

    //添加子菜单
    public void add(MenuComponent component){
    }

    //移除子菜单
    public void remove(MenuComponent component){
    }

    //获取指定的子菜单
    public MenuComponent getChild(int index){
        throw new UnsupportedOperationException();
    }

    //获取菜单或菜单名称
    public String getName(){
        return name;
    }

    //打印菜单名称的方法
    public abstract void print();
}
